<?php

namespace App\Http\Requests\Admin;

use App\Http\Requests\Admin\Request;

class UserAddRequest extends Request
{
    public function rules()
    {
        return [
            'username' => 'required|unique:users,username|min:6',
            'name' => 'required',
            'password' => 'required|min:6',
            'mobile' => 'required|regex:/^1[34578][0-9]{9}$/|unique:users,mobile,NULL,id,deleted,0',
            'code' => 'required|unique:users,code,NULL,id,deleted,0|identitycards',
            'card_pwd' => 'required',
        ];
    }

    public function messages()
    {
        return [
            'username.required' => '会员账号不能为空',
            'username.unique' => '该会员账号已经被注册',
            'username.min' => '该会员账号不能少于6位',
            'name.required' => '姓名不能为空',
            'password.min' => '密码不能少于6位',
            'password.required' => '密码不能为空',
            'mobile.required' => '手机号不能为空',
            'mobile.regex' => '手机号格式不对',
            'mobile.unique' => '手机号已经注册',
            'code.required' => '身份证不能为空',
            'code.unique' => '该会员身份证已经被注册',
            'card_pwd.required' => '提现密码不能为空',
        ];
    }
}
